package com.example.administrator.kotlindemo;

import android.app.Application;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.support.multidex.MultiDex;
import android.util.Config;
import android.util.Log;

import com.bumptech.glide.request.target.ViewTarget;
import com.zcx.helper.glide.GlideLoader;
import com.zcx.helper.http.Http;

/**
 * Created by Administrator on 2017/8/1.
 */

public class BaseApplication extends Application{

    private static final String TAG = "BaseApplication";
    private static Context mContext;
    public static BasePreferences basePreferences;



    @Override
    public void onCreate() {
        MultiDex.install(this);
        super.onCreate();

//        try {
//            //https双向证书
//            Http.getInstance().setCertificates(null, getAssets().open("client2222.p12"), "123123", "PKCS12");
//        } catch (IOException e1) {
//            e1.printStackTrace();
//        }


        //网络请求等待框，可自定义
        mContext = this;

        Http.getInstance().setOnStartEndCreateDialog(new Http.OnStartEndCreateDialog() {

            @Override
            public Dialog onCreate(Context context) {

                return new ProgressDialog(context);

            }

            @Override
            public void show(Dialog dialog) {
                dialog.show();
            }

            @Override
            public void dismiss(Dialog dialog) {
                dialog.dismiss();
            }

        });


        //初始化GLide图片加载框架
        GlideLoader.getInstance().init(this, R.mipmap.ic_launcher);



    }


    /**
     * 获取全局的context
     */
    public static Context getContext() {
        return mContext;
    }





}
